The declaration of out opens the file. The declaration of in uses the stream buffer of out to read
from it. Note that out must be opened for both reading and writing. If it is opened only for writing,
reading from the stream will result in undefined behavior. Also note that in is not of type ifstream
but only of type istream. The file is already opened and there is a corresponding stream buffer. All
that is needed is a second stream object. As in previous examples, the file is closed when the file
stream object out is destroyed.