As the book says (Exploring C++: The Programmer\'s Introduction to C++):
The istream header declares input operators (>>), and ostream declares outp
I can perfectly run that code without adding #include ostream;
You happen to be able to on your specific installation. Upgrade your toolchain and that may no longer be the case.
As of C++11 you can assume it for iostream
/ostream
, but there are other similar scenarios which C++11 does not cover.
So, a general rule of thumb: whenever you use a standard library feature, include the header where it's declared/defined, rather than making assumptions and shortcuts.