Could you please describe a little bit more what you own streamclass should do?
Just asking how without what is not the best way to get a constructive answer.
Maybe you should have a look at boost::iostream, as there is a much simpler and safer way to write own iostream classes.