   Overloading  operator
  Hello, Im trying to overload the << operator but keep getting this error: `std::ostream& Vector2::operator<<(std::ostream&, const Vector2&)' must take exactly one argument std::ostream& operator <<(std::ostream &strm, const Vector2 &vector);Don't know why it's giving me that error. Any help would be great, thanks.   
  Operators overloaded as class member functions automatically have a left-hand operand of the class type identified as this, which means you are only allowed to specify the right-hand operand as a parameter.In your case, you want to use a non-member operator, because your left-hand operator is an instance of another class.   ;Quote:Original post by ToohrVykIn your case, you want to use a non-member operator, because your left-hand operator is an instance of another class.In your case, you NEED to use a non-member operator, because you left-hand OPERAND is an...If you want to use left hand operand as stream (or any class other than Vector2 in your case) you should make the function non-member. This is a limitation in member operator overloads that first (left) operand (implicitly) be "this" object. 