title: Unclear use of operator double()
body: <p>I have a <code>Rectangle</code> class with conversion operators to both <code>double</code> and <code>std::string</code>:</p>
  
  <pre><code>class Rectangle
  {
  public:
      Rectangle(double x, double y) : _x(x), _y(y) {}
      operator std::string ();
      operator double ();
  private:
      double _x, _y;
      double getArea() {return _x * _y;}
  };
  
  int main()
  {
      Rectangle r(3, 2.5);
      cout &lt;&lt; r &lt;&lt; endl;
      return 0;
  }
  </code></pre>
  
  <p>I don’t understand why <code>operator double()</code> is invoked, rather than <code>operator std::string()</code>.
  As far as I know, according to <a href="https://en.wikibooks.org/wiki/C%2B%2B_Programming/Operators/Operator_Overloading" rel="noreferrer">C++ wikibook</a>,
  <code>operator double</code> is used to convert <code>Rectangle</code> objects to <code>double</code>.</p>
  
  <p>So what's going on here?  Is it related to the fact that an <code>int</code> is passed to the constructor?  If so, why?</p>