Originally Posted by
laserlight
If it needs access to the internals then it should be a member or a friend. But since it does not need to be a member, it should be a friend. That said, it crosses my mind that it need not access the internals to begin with: the problem is one of finding a subrange in some range, so if you have the begin and end iterators of the range, and the begin and end iterators of the subrange, you can solve the problem. The std::search generic algorithm already solves this, so you just need to write a function to use it.