title: c++ - Conversion from Custom Classes to built in types
body: <p>For the sake of clarity Let my new class be:  </p>
  
  <pre><code>class MyInt{
      public: 
        MyInt(int x){theInt = x /10;} 
        int operator+(int x){return 10 * theInt + x;} 
      private 
        int theInt; 
  };
  </code></pre>
  
  <p>let's say I want to be able to define: </p>
  
  <pre><code>MyInt Three(30); 
  int thirty = Three; 
  </code></pre>
  
  <p>But in order to get this result I'm writing: </p>
  
  <pre><code>MyInt Three(30); 
  int thirty = Three + 0; 
  </code></pre>
  
  <p>how can I get automatic conversion from my Custom class to a built-in type? </p>