#include template struct EdgePrinter { typedef Graph_t Graph; EdgePrinter( Graph& g ) : graph(g) {} protected: Graph& graph; }; template struct GraphPrinter: public EdgePrinter { GraphPrinter( Graph& g ) : EdgePrinter(g) {} const GraphPrinter& operator () ( std::ostream& out ) const { std::cout << this->graph << "\n"; } }; int main() { }