In TC++PL 3edn, in section 21.2.2, Stroustrup
notes that put( ) and write( ) simply write chars.
Therefore, << for outputting chars need not be a member
What does he mean here ?
Imagine for a second that the << operator was a member of basic_ostream,
that would mean that typing
std::cout << "Hello";
would actually be a call to
std::cout.operator<<("Hello");
What would then happen when you make your own class myClass that you
want to be able to print? That would mean that you would have to change
basic_ostream to add an overloaded version of the << operator for
myClass. But since you didn't write the basic_ostream and might not have
the code you would not be able to.
By not making the << operator a member of basic_ostream you solve this
problem since anyone then can create their own overloaded function which
prints their class.
So what actually happens is that your 'std::cout << "Hello";' calls a
function something like this (I skip some of the template-stuff)
basic_ostream& operator<<(basic_ostream& o, const char* c);
so the call is actually
basic_ostream& operator<<(std::cout, "Hello");
So all you have to do to make myClass easily printable is implement a
function like
basic_ostream& operator<<(basic_ostream& o, myClass& m);
Also, class basic_ostream does not have
operator << (char ch)
Since it's not a member, but if you look at the list of functions right
at the end of 21.2.2 you'll see the non-member function (the second one
in my book).