Binding overloaded operators is ... tricky, to say the least.
Basically, you need to do an explicit cast in order to let the compiler select the correct overload. That is, you need something like
The whole thing is such a mess that you don't really save any code. Just thing about how often
static_cast< std::ostream& (*)(std::ostream&, const char*) >(&std::operator << <std::char_traits<char> >), std::cout, "Test");
std::cout << msg;
fits into the horrible line above.
A better choice here would be Boost.Lambda:
(ll::ref(std::cout) << "Test")
Assuming you have
namespace ll = boost::lambda