The relationship between headers and classes is not necessarily one-to-one; that just a rule of thumb often teaches novice programmers. In fact, the C ++ language standard does not indicate any direct relationship between classes, implementation files (translation units), and headers in general, and the standard library often deviates from this rule.
std::iostream is a typedef for the std::basic_iostream template std::basic_iostream (in particular, for basic_iostream<char> ). On my platform, <iostream> includes <istream> , which defines basic_iostream , as well as <iosfwd> , which contains typedef .
source share