Overload binary plus operator

Write a program overload binary plus operator.

#include<iostream>
using namespace std;
class A
{
	private:
		int x,y;
	public:
		A(int a,int b);
		A();
		void print();
		//A operator +(A&);
		friend A& operator +(A&,A&);
};
#if 1
//using friend function
A& operator +(A& ob1,A& ob2)
{
	static A t;
	t.x = ob1.x + ob2.x;
	t.y = ob1.y + ob2.y;
	return t;
}
#else
//using member function
A A :: operator +(A &ob)
{
	A temp;
	temp.x = x + ob.x;
	temp.y = y + ob.y;
	return temp;
}
#endif
A :: A(int a,int b):x(a),y(b)
{
	cout << "parameterized constructor" << endl;
}
A :: A()
{
	cout << "default constructor" << endl;
}
void A :: print()
{
	cout << "x = " << x << " y = " << y << endl;
}
int main()
{
	A obj1(10,20),obj2(20,10),obj3;
	obj3 = obj1 + obj2;//obj3 = obj1.operator+(obj2) for member function
	obj1.print();
	obj2.print();
	obj3.print();
	return 0;
}

Output

parameterized constructor
parameterized constructor
default constructor
default constructor
x = 10 y = 20
x = 20 y = 10
x = 30 y = 30