Well, the fstream family inherits from istream / ostream, so this can be done.
ofstream outFile("myfile");
The question of how common it is is more interesting. In my experience, not really. An attractive motivation would be to use standard algorithms (or some of your own decisions). But since the structure / class that you want to read / write should have all the necessary infrastructure (ctors, stream operator, etc.) Already in place, I think most people do not see the point at all. For instance.
data d(...); *dataIterOut = d;
Duck source share