Changed base_stream macro to a template alias

...called base_stream_to, just to avoid problems. Also changed lots of
stream checking, thanks to is_stream_base_of.