CS202 6- ‹#›
Overloading <<, >> Operators
nWe know from examining how these operators behave on built-in types that extraction will modify the second operand but the insertion operator will not.
nTherefore, the extraction operation should declare the second operand to be a reference.
nThe insertion operator should specify the second operator to be a constant reference.
nThe return value should be a reference to the object (istream or ostream) that invoked the operator for chaining.
n cin >> str >>i;
n cout << str <<i;
n