/*Orion Lawlor's Simple C++ Examples, olawlor@acm.org
Shows how to overload a class foo's ostream 
output operator (<<).
*/
#include <iostream>

class foo {
private:
	double val;
public:
	foo(double x):val(x) {}
	
	friend std::ostream &operator<<(std::ostream &o,const foo &f) {
		o<<" Foo.val="<<f.val<<" ";
		return o;
	}
};

int main()
{
	foo f(7.3);
	std::cout<<"My f is "<<f<<std::endl;
	return 0;
}
/*<@>
<@> ******** Program output: ********
<@> My f is  Foo.val=7.3 
<@> */
