There are two kinds of reasons to extend the basic stream classes. The first is to specialize to a particular kind of streambuf and the second is to add some new state variables.