I wish I understood your response because I always find overloading operators difficult. What I find myself doing is copying the code and not understanding why it works.
Well the left operand of a member operator must always be an object of the class that contains it.
So since cout is the left operand of <<, you would have to have it as a member of iostream (or specifically, ostream) to make it work the way it's normally used. So it has to stand alone.
All binary operators (with two operands) have two operands. And the first parameter is always the left, in a standalone. If it's a member, the left is the class it's a member of, and it only takes one operand.
Thank you, but just to make sure I have some understanding; the << operator would be considered a standalone(correct), and + operator would be considered a binary operator?
+ is a binary operator. But it could be treated as member or nonmember.
Both << and + are binary operators, because they have two things (cout and an object, or two objects). An operator such as increment, ++, would be unary. There is only one ternary operator, the ? operator, and I don't remember if you can overload that.
Got it--and I just read an explanation on wikipedia. Thank you, so much I am not sure why and had so much trouble wrapping my mind around this concept.