Why can some operators only be overloaded as member functions, other as friend functions and the rest of them as both?
问题 Why can some operators only be overloaded as member functions, other as non-member "free" functions and the rest of them as both? What is the rationale behind those? How to remember which operators can be overloaded as what (member, free, or both)? 回答1: The question lists three classes of operators. Putting them together on a list helps, I think, with understanding why a few operators are restricted in where they can be overloaded: Operators which have to be overloaded as members. These are