title: Scala: method\operator overloading
body: <p>The following example is from the book 'Programming in Scala'. Given a class 'Rational' and the following method definition:</p>
  
  <pre><code>def add(that: Rational): Rational =
      new Rational(
          this.numer * that.denom + that.numer * this.denom,
          this.denom * that.denom
      )
  </code></pre>
  
  <p>I can successfully overload the add method with a convenience version that takes an Int argument, and <strong>makes use of the definition above</strong>:</p>
  
  <pre><code>def add(that: Int): Rational =
      add(new Rational(that, 1))
  </code></pre>
  
  <p>No problems so far.</p>
  
  <p>Now, if I change the method name to an operator style name:</p>
  
  <pre><code>def +(that: Rational): Rational =
      new Rational(
          this.numer * that.denom + that.numer * this.denom,
          this.denom * that.denom
      )
  </code></pre>
  
  <p>And overload like so:</p>
  
  <pre><code>def +(that: Int): Rational =
      +(new Rational(that, 1))
  </code></pre>
  
  <p>I get the following compile error:</p>
  
  <pre><code>(fragment of Rational.scala):19: error: value unary_+ is not a member of this.Rational
  +(new Rational(that, 1))
   ^
  </code></pre>
  
  <p>Why is the compiler looking for a unary version of the <code>+</code> method?</p>