Overload insertion operator

Write a program to overload the insertion operator.

#include<iostream>
using namespace std;
class A
{
	private:
		int x,y;
	public:
		A(){}
		A(int a,int b):x(a),y(b){}
		friend A& operator << (ostream &,A&);
};
A& operator << (ostream& out,A& ob)
{
	out << "x = " << ob.x <<  " y = " << ob.y << endl;
}
int main()
{
	A obj1(12,34),obj2(72,42);
	cout << obj1;//cout.operator <<(A&);
	cout << obj2;
	return 0;
}

Output

x = 12 y = 34
x = 72 y = 42