I am trying to overload the stream insertion operator for an assignment. In my header file, I have the following:
friend ostream& operator<<(ostream, Vector);
In my implementation file, I have:
friend ostream& operator<<(ostream& outputStream, Vector& displayMe) {
outputStream << "<" << displayMe.GetVX << "," << displayMe.GetVY << ">";
return outputStream;
}
I am getting an error that says:
"invalid specifier outside a class declaration"
The error is pointing to the line that begins with friend ostream& in my implementation file.
I am new to operator overloading obviously. Am I supposed to define this outside of the class? I am just confused about why I am getting this error and how I go about fixing my code. Any suggestions would be helpful.