title: Error reference to 'distance' is ambiguous
body: <p>I cannot figure out why I am getting the error &quot;<code>reference to 'distance' is ambiguous</code>&quot;.<br />
  I have passed class object as an argument in friend function.</p>
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  class distance {
      int meters = 0;
  public:
      distance() {}
      void displaydata() {
          cout &lt;&lt; &quot;Meters Value:&quot; &lt;&lt; meters;
      }
      //Prototype
      friend void addvalue(distance &amp;d);
  };
  
  void addvalue(distance &amp;d) {
      d.meters += 5;
  }
  
  int main() {
      distance d1; // meters = 0
      d1.displaydata(); // 0
      // The friend function call
      addvalue(d1); // pass by reference
      d1.displaydata();
  }
  </code></pre>