Searching for the title of this question gives me a number of people quoting the same error, but under different circumstances, and unfortunately the answers there provided are
Change this:
std::ostream& operator<< ( std::ostream&, Vector< U, M >& );
to this:
std::ostream& operator<< ( std::ostream&, const Vector< U, M >& );
// ^^^^^
The compiler is telling you that C++ will not let you bind a temporary Vector
such as u + v
to a non-const Vector&
.
And you don't modify that Vector
, so it should be const
to begin with.