It is illegal to bind a temporary object to a non-const reference:
cout << (int1 + int2) << endl; // The result of the '+' is temporary object.
To correct, change the argument of your operator<<
to a const Integer&
:
ostream& operator<<(ostream& output, const Integer& integer);
//^^^^^