I have a header file where I am declaring a bool operator as a public member of the function RewardCard
bool operator ==(const RewardCard& card1, const RewardCard& card2);
I have moved all implementation details of the class I am defining into a separate file rewards.cpp which includes the headerfile
I have defined the bool operator as follows:
bool RewardCard::operator ==(const RewardCard& card1, const RewardCard& card2)
{
return(card1.name == card2.name && card1.id == card2.id && card1.store == card2.store)
}
When compiling the program I am getting an error that says this function must take exactly one argument.
I am avoiding a friend function for overloading as I know these can be achieved using a member function.
What am I doing incorrectly?