I try to overload operator== , but the compiler throws the following error:
 'bool Rationalnumber::operator==(Rationalnumber, Rationalnumber)' must take exactly one argument 
My short piece of code is as follows:
 bool Rationalnumber::operator==(Rationalnumber l, Rationalnumber r) { return l.numerator() * r.denominator() == l.denominator() * r.numerator(); } 
Declaration:
 bool operator==( Rationalnumber l, Rationalnumber r ); 
Does anyone have any idea why he is throwing a mistake?
source share