Add adapt_stream_pointer method to take C++ stream by (smart) pointer.