An ifstream object contains data that manages the output to the file, such as the next few characters to send to the file, the state of the stream, and so on.
The parameter is a reference because that data needs to be modified during stream operations. .