title: error in type conversion in operator overloading
body: <p>I have a template class and I need to overload operator ==. I do this in the following way</p>
  
  <pre><code>template &lt;typename T&gt;
  class Polynomial {
      vector&lt;T&gt; coefficients;
  
      public:
      Polynomial(vector&lt;T&gt; c);
  
      bool operator ==(const Polynomial&amp; second) const {
              const typename vector&lt;T&gt;::iterator thisBegin = this-&gt;coefficients.begin();
              const typename vector&lt;T&gt;::iterator secondBegin = second.coefficients.begin();
              for ( ; ((thisBegin != this-&gt;coefficients.end()) &amp;&amp;
                                      (secondBegin != second.coefficients.end()));
                              ++thisBegin, ++secondBegin) {
                      if (*thisBegin != *secondBegin)
                              return false;
              }
              while (thisBegin != this-&gt;coefficients.end()) {
                      if (*thisBegin != 0)
                              return false;
                      ++thisBegin;
              }
              while (secondBegin != second.coefficients.end()) {
                      if (*secondBegin != 0)
                              return false;
                      ++secondBegin;
              }
              return true;
      }
  };
  </code></pre>
  
  <p>However, when I create two objects of this class with T=int and try to apply  this operator</p>
  
  <pre><code>Polynomial&lt;int&gt; first(firstVector);
  Polynomial&lt;int&gt; second(secondVector);
  std::cout &lt;&lt; (first == second) &lt;&lt; std::endl;
  </code></pre>
  
  <p>I got the error</p>
  
  <pre><code>problem2.cpp: In instantiation of ‘bool Polynomial&lt;T&gt;::operator==(const Polynomial&lt;T&gt;&amp;)    const [with T = int; Polynomial&lt;T&gt; = Polynomial&lt;int&gt;]’:
  problem2.cpp:63:32:   required from here
  problem2.cpp:23:83: error: conversion from ‘std::vector&lt;int, std::allocator&lt;int&gt; &gt;::const_iterator {aka __gnu_cxx::__normal_iterator&lt;const int*, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt;}’ to non-scalar type ‘std::vector&lt;int, std::allocator&lt;int&gt; &gt;::iterator {aka __gnu_cxx::__normal_iterator&lt;int*, std::vector&lt;int, std::allocator&lt;int&gt; &gt; &gt;}’ requested
  </code></pre>
  
  <p>Can someone point out what's wrong with this conversion? Thanks!</p>