Changed std::ostream to a generic version