title: Unable to overload stream extraction operator (>>) in C++
body: <p>I'm currently trying to understand the basic concepts of operator overloading in C++. Therefore, I created a class <code>wheel</code> that is able to read from a stream by overloading the stream extraction operator <code>&gt;&gt;</code>.</p>
  
  <p><strong>wheel.h</strong></p>
  
  <pre><code>#ifndef WHEEL_H
  #define WHEEL_H
  
  #include &lt;cassert&gt;
  #include &lt;ostream&gt;
  #include &lt;string&gt;
  
  class wheel final {
      float rimDiameter;
      int productionYear;
      std::string velocityIndex = "N/A";
      std::string manufacturer = "N/A";
  
  public:
      wheel() = default;
  
      wheel(  float rimDiameter,
              int productionYear,
              std::string velocityIndex,
              std::string manufacturer
          ) : rimDiameter{rimDiameter},
              productionYear{productionYear},
              velocityIndex{velocityIndex},
              manufacturer{manufacturer}
          {}
  
      ~wheel() = default;
  
      friend
      auto operator&lt;&lt;(std::ostream &amp;os, const wheel &amp;self) -&gt; std::ostream &amp;;
  
      friend
      auto operator&gt;&gt;(std::istream &amp;is, wheel &amp;self) -&gt; std::istream &amp;;
  };
  
  #endif
  </code></pre>
  
  <p><strong>wheel.cpp</strong></p>
  
  <pre><code>#include "wheel.h"
  
  auto operator&lt;&lt;(std::ostream &amp;os, const wheel &amp;self) -&gt; std::ostream &amp; {
      return os &lt;&lt; "   WHEEL" &lt;&lt; std::endl
          &lt;&lt; "   =============================" &lt;&lt; std::endl
          &lt;&lt; "      Rim Diameter:       " &lt;&lt; self.rimDiameter &lt;&lt; "\"" &lt;&lt; std::endl
          &lt;&lt; "      Year of Production: " &lt;&lt; self.productionYear &lt;&lt; std::endl
          &lt;&lt; "      Velocity Index:     " &lt;&lt; self.velocityIndex &lt;&lt; std::endl
          &lt;&lt; "      Manufacutrer:       " &lt;&lt; self.manufacturer &lt;&lt; std::endl;
  }
  
  
  auto operator&gt;&gt;(std::istream &amp;is, wheel &amp;self) -&gt; std::istream &amp; {
      char c[3];
  
      is &gt;&gt; 
          self.rimDiameter &gt;&gt; c[0] &gt;&gt; 
          self.productionYear &gt;&gt; c[1] &gt;&gt;
          self.velocityIndex &gt;&gt; c[2] &gt;&gt; 
          self.manufacturer;
  
      assert(c[0] == ';' &amp;&amp; c[1] == ';' &amp;&amp; c[2] == ';');
      return is;
  }
  </code></pre>
  
  <p><strong>main.cpp</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "wheel.h"
  
  int main(void) {
      wheel w;
  
      std::cin &gt;&gt; w;
      std::cout &lt;&lt; w;
  
      return 0;
  }
  </code></pre>
  
  <p>To me, it all looks fine, but somehow I keep getting an error telling me that there is <code>no match for 'operator&gt;&gt;' (operand types are 'std::istream {aka std::basic_istream&lt;char&gt;}' and 'float')</code>:</p>
  
  <pre><code>$ make
  g++-7 -g -std=c++17 -Wall -Wextra -Wconversion -Wpedantic -c main.cpp
  g++-7 -g -std=c++17 -Wall -Wextra -Wconversion -Wpedantic -c wheel.cpp
  wheel.cpp: In function 'std::istream&amp; operator&gt;&gt;(std::istream&amp;, wheel&amp;)':
  wheel.cpp:16:8: error: no match for 'operator&gt;&gt;' (operand types are 'std::istream {aka std::basic_istream&lt;char&gt;}' and 'float')
       is &gt;&gt;
       ~~~^~
           self.rimDiameter &gt;&gt; c[0] &gt;&gt;
           ~~~~~~~~~~~~~~~~
  wheel.cpp:13:6: note: candidate: std::istream&amp; operator&gt;&gt;(std::istream&amp;, wheel&amp;)
   auto operator&gt;&gt;(std::istream &amp;is, wheel &amp;self) -&gt; std::istream &amp; {
        ^~~~~~~~
  wheel.cpp:13:6: note:   no known conversion for argument 2 from 'float' to 'wheel&amp;'
  In file included from /usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/string:53:0,
                   from /usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/bits/locale_classes.h:40,
                   from /usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/bits/ios_base.h:41,
                   from /usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/ios:42,
                   from /usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/ostream:38,
                   from wheel.h:5,
                   from wheel.cpp:1:
  /usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/bits/basic_string.tcc:1465:5: note: candidate: template&lt;class _CharT, class _Traits, class _Alloc&gt; std::basic_istream&lt;_CharT, _Traits&gt;&amp; std::operator&gt;&gt;(std::basic_istream&lt;_CharT, _Traits&gt;&amp;, std::__cxx11::basic_string&lt;_CharT, _Traits, _Alloc&gt;&amp;)
       operator&gt;&gt;(basic_istream&lt;_CharT, _Traits&gt;&amp; __in,
       ^~~~~~~~
  /usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/bits/basic_string.tcc:1465:5: note:   template argument deduction/substitution failed:
  wheel.cpp:17:14: note:   mismatched types 'std::__cxx11::basic_string&lt;_CharT, _Traits, _Alloc&gt;' and 'float'
           self.rimDiameter &gt;&gt; c[0] &gt;&gt;
                ^~~~~~~~~~~
  make: *** [wheel.o] Error 1
  </code></pre>
  
  <p>What am I missing here?</p>