title: How to use `duration_cast` for a derived class?
body: <p>I'm cleaning up my timer class using <code>std::chrono</code>. Everything else went smooth except that I cannot seem to apply <code>duration_cast</code> to derived classes. Well, I made it work in a different way, but I'd still like to know what I missed.</p>
  
  <p>See <a href="http://ideone.com/TuVs4g" rel="nofollow">here</a> for the error message.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;chrono&gt;
  
  typedef std::chrono::high_resolution_clock Clock;
  
  class Milliseconds : public std::chrono::milliseconds
  {
  public:
      typedef std::chrono::milliseconds Base;
      typedef Base::rep Type;
  
      using Base::Base;
  };
  
  inline Milliseconds::Type millisecondsSinceEpoch()
  {
      return std::chrono::duration_cast&lt;Milliseconds::Base&gt;(Clock::now().time_since_epoch()).count();
      //duration_cast&lt;Milliseconds&gt; ERROR!
  }
  
  int main() {
      using namespace std;
      cout &lt;&lt; millisecondsSinceEpoch() &lt;&lt; endl;
      return 0;
  }
  </code></pre>