These flags are maintained by the class basic_ios and are thus present in all objects of type
basic_istream or basic_ostream. However, the stream buffers don’t have state flags. One
stream buffer can be shared by multiple stream objects, so the flags represent only the state of the
stream as found in the last operation. Even this is the case only if goodbit was set prior to this
operation. Otherwise, the flags may have been set by an earlier operation.