I have a function that takes an ostream reference as an argument, writes some data to the stream, and then returns a reference to that same stream, like so:
ostream
This would work, to combine print with << and control the order:
print
<<
print( std::cout << "Hello, world!" ) << std::endl;
Or, if you want a function that's called with <<, see Joachim's answer.