ostream is a base class of ofstream, I'm pretty sure. There's an IS-A relationship. Thus so long as the function is available to be called and the underlying object is an ofstream, the behavior will be the same.

What behavior you'd expect for an ostream that is *not* an ofstream is an open question, but probably not one you'd need to worry about too much.