using namespace std; namespace std { template struct char_traits; template > class basic_ostream; typedef basic_ostream ostream; } class A {}; class B: public A {}; class C: public B { virtual void f(std::ostream& os) const; }; void C::f(ostream& os) const {}