Another good thing about making it an external function is that you can have things like this:
Code:
bool operator==( const string& lhs, const string& rhs )
{
return lhs.compare(rhs);
}
bool operator==( const string& lhs, const char* rhs )
{
return lhs.compare(rhs);
}
bool operator==( const char* lhs, const string& rhs )
{
return rhs.compare(lhs);
}
Then you can compare different types no matter which side of the == they're on. If it was a member function, the string example above would only be able to compare: string == string, and string == char*, but not char* == string.