I am trying to overload += operator for my template Polynom class in a way so I would be able to use both Polynoms and constants as argument.
I wrote a constructor and following operator inside my class:
Polynom(const T& num = 0) {
  coefs.push_back(num);
}
friend Polynom& operator += (Polynom& lhs, const Polynom& rhs) {
  ...
}
And it works fine, I am able to use: poly += 1;. When compiler runs into something likes that what does it do? It sees that there is no += operator that uses these arguments:
(Polynom<int>& lhs, const int)
But there is one for:
(Polynom<int>& lhs, const Polynom& rhs)
So, it tries to convert const int to const Polynom&? And it uses constructor for that, right? But then why doesn't this declaration work when adding a constant:
Polynom& operator += (Polynom& rhs) {
  ...
}
Compiler says "no match for operator +=".
 
     
    