Include chain is ostream -> ios -> iosfwd -> bits/c++io.h -> bits/gthr.h -> bits/gthr-default.h -> unistd.h. The same chain also includes pthread.h. These are imported at file scope, not in namespace std, which pollutes the application name space.
I tried to report this to libstdc++ project, but their reporting instructions seem to lead here although strictly there's no problem with the compiler itself. -- Summary: ostream includes unistd.h outside namespace std, polluting Product: gcc Version: 4.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: igodard at pacbell dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36231