title: Scala: Is it possible to indicate a generic class which implements a certain method
body: <p>I thinks it's easier to explain it with a simple example. (help rephrasing the title is welcome ;-)</p>
  
  <p>I'd like to implement a <code>squared</code> method and, using <code>implicit def</code>, automatically add it to any class that supports the <code>*</code>-operator.</p>
  
  <p>With an Int it's very easy:</p>
  
  <pre><code>class EnhancedInt(x: Int) { def squared = x * x }
  
  implicit def IntToEnchancedInt(x: Int) = new EnhancedInt(x)
  </code></pre>
  
  <p>But with Any or AnyVal I get the following error:</p>
  
  <pre><code>scala&gt; class EnhanceAny(x: AnyVal) { def squared = x * x }
  &lt;console&gt;:7: error: value * is not a member of AnyVal
         class EnhanceAny(x: AnyVal) { def squared = x * x }
  </code></pre>
  
  <p>I'd like to know how I could apply it to any numeric class, or, even better, to any class supporting the <code>*</code>-operator.</p>