title: Is it OK to inherit from the C++11 smart pointers and override the relative operators?
body: <p>According to <a href="http://en.cppreference.com/w/cpp/memory/shared_ptr">cppreference.com</a>, <code>std::shared_ptr</code> provides a full set of relative operators (==, !=, &lt;, ...), but the semantics of comparison aren't specified. I assume they compare the underlying raw pointers to the referenced objects, and that std::weak_ptr and std::unique_ptr do the same.</p>
  
  <p>For some purposes, I would prefer to have relative operators that order the smart pointers based on comparing the referenced objects (rather than the pointers to them). This is already something I do a lot, but with my own "dumb pointers" that behave mostly like raw pointers except for the relative operators. I'd like to do the same thing with the standard C++11 smart pointers too. So...</p>
  
  <ol>
  <li><p>Is it OK to inherit from the C++11 smart pointers (shared_ptr, weak_ptr and unique_ptr) and override the relative operators?</p></li>
  <li><p>Are there any sneaky issues I need to look out for? For example, are there any other methods I need to implement or use <code>using</code> for to ensure things work correctly?</p></li>
  <li><p>For the ultimate in laziness, is there a library template available that will do this for me automatically?</p></li>
  </ol>
  
  <p>I'm hoping this is an "of course you can do that, idiot!" kind of thing, but I'm a little uncertain because there are some classes in the standard library (containers like <code>std::map</code> at least) that you're not supposed to inherit from.</p>