title: no match for operator=
body: <p>I have created a class called data and overloaded some operators to perform some operation on the object of this class.</p>
  
  <pre><code>class data{
  public:
  int distance;
  int parent;
  int node_number;
  data();
  data(int, int, int);
  bool operator&lt;(data &amp;);
  bool operator&gt;(data &amp;);
  bool operator&gt;=(data &amp;);
  bool operator&lt;=(data &amp;);
  bool operator==(data &amp;);
  void operator=(data &amp;);
  data operator+(int &amp;);
  };
  </code></pre>
  
  <p>two of the overloaded operator definition is as follows.</p>
  
  <p>For assignment operator:</p>
  
  <pre><code>void data::operator=(data &amp; d){
  this-&gt;distance = d.distance;
  this-&gt;parent = d.parent;
  this-&gt;node_number = d.node_number;
  }
  </code></pre>
  
  <p>for addition operator:</p>
  
  <pre><code>data data::operator+(int &amp; d){
  data l;
  l.node_number = this-&gt;node_number;
  l.parent = this-&gt;parent;
  l.distance = this-&gt;distance + d;
  return l;
  } 
  </code></pre>
  
  <p>When I am using object of this class in my one of the function like this..</p>
  
  <pre><code>void d1::dijkstra::relax(int u, int v){
  data accumulated_weight;
  accumulated_weight = *this-&gt;v[u] + this-&gt;g[u][v]; //Getting error at this line
  if(*this-&gt;v[v] &gt; accumulated_weight){
      this-&gt;fh.fib_heap_decrease_key(*this-&gt;v[v], accumulated_weight);
      this-&gt;v[v]-&gt;parent = u;
  }
  }
  </code></pre>
  
  <p>I am getting error at the line indicated.</p>
  
  <p>Error says: no match for ‘operator=’ (operand types are ‘data’ and ‘data’)|
  note:   no known conversion for argument 1 from ‘data’ to ‘data&amp;’</p>
  
  <p>What is wrong in the method I am using? What should be proper way to use this?</p>
  
  <p>Edit: This pointer is referring to this class:</p>
  
  <pre><code>namespace d1{
      class dijkstra{
      private: int number_of_vertices;
      private: std::vector&lt; std::vector&lt;int&gt; &gt; g;
      private: std::vector&lt;data *&gt; v;
      private: int source;
      private: a1::heap fh;
      private: void initialize_single_source();
      private: void relax(int, int);
      public: dijkstra(std::vector&lt; std::vector&lt;int&gt; &gt; &amp;, int);
      public: void run();
      public: void print_graph();
  };
  };
  </code></pre>