title: Unable to use ifstream::operator>> using ifstream reference
body: <p>I am using C++11.</p>
  
  <p><code>std::ifstream</code> inherits from <code>std::istream</code>, so it should theoretically be capable of doing all the same things, but this does not seem to be the case.</p>
  
  <p>I can define the same function in two ways:</p>
  
  <pre><code>void parse(std::ifstream &amp;file) {
          for (std::string word; file &gt;&gt; word; );
  }
  
  void parse(std::istream &amp;file) {
          for (std::string word; file &gt;&gt; word; );
  }
  </code></pre>
  
  <p>When an <code>istream</code> is used, there is no error.</p>
  
  <p>When I use <code>ifstream</code>, this error is returned from both g++ and clang++ (with slight variation):</p>
  
  <pre><code>error: invalid operands to binary expression ('std::ifstream' (aka 'basic_ifstream&lt;char&gt;') and 'std::string' (aka 'basic_string&lt;char&gt;'))
          for (std::string word; file &gt;&gt; word; ) {
                                 ~~~~ ^  ~~~~
  </code></pre>
  
  <p>I could use an <code>istream&amp;</code> and use polymorphism to pass in an <code>ifstream&amp;</code>, but I would prefer not to, and I would like to figure why this happens.</p>