I am practicing operator overloading , i have done hundred times operator overloading but this time it's behavior is irritating if I compare this code with old code syntax (that complies fine) i find no change in syntax ,kindly guide me.Thanks
EROR : [Error] 'two operator=(one, two)' must be a nonstatic member function
#include<iostream>
using namespace std;
class two;
class one{
int sno;
public:
one()
{
sno=312;
}
friend two operator =(one,two);
};
//b b1; b1=a.seatno;
class two{
int seatno;
public:
two(){seatno=0;
}
friend two operator = (one,two);
};
two operator = (one a1,two b1)
{
b1.seatno=a1.sno;
return b1;
}
int main()
{
one a1;
two b1;
b1=a1;
}
[Error] 'two operator=(one, two)' must be a nonstatic member function