Polynomial.cpp:89: error: ‘std::ostream& Polynomial::operator<<(std::ostream&, const Polynomial&)’ must take exactly one argument
The error no longer occurs when I take out the Polynomial:: part, but I'm wondering why. Can operator overloaders not be member functions? Or is it because this function is a friend?
Operator member functions take a reference to object as first argument implicitely.
So operator Polynomial::operator<<(/*operands*/) is threated like operator<<(Polynomal&, /*operands) */
As operator<< takes two arguments, member version is left with only one left to define.
This is why you should define stream operator as non-member: as first argument should be stream it can only be a member of that stream, which you cannot change.