'friend' functions and << operator overloading: What is the proper way to overload an operator for a class?
问题 In a project I\'m working on, I have a Score class, defined below in score.h . I am trying to overload it so, when a << operation is performed on it, _points + \" \" + _name is printed. Here\'s what I tried to do: ostream & Score::operator<< (ostream & os, Score right) { os << right.getPoints() << \" \" << right.scoreGetName(); return os; } Here are the errors returned: score.h(30) : error C2804: binary \'operator <<\' has too many parameters (This error appears 4 times, actually) I managed