C++: passing object reference as parameter gives error: no matching function for a call to class::function() : <p>Passing an object reference as parameter gives me the error:<br>
<code>No matching function for a call to i2cController::i2cController</code></p>

<p>I've also tried passing a pointer, and creating the i2cController with new.<br>
Both tries gave me the same result.<br>
Why is it even complaining about a call to i2cController, am I not passing the object instead of calling it? </p>

<p><strong>i2Controller (Passed object)</strong></p>

<p>i2cController.h</p>

<pre><code>#pragma once

class i2cController
{
private:
  int foo;

public:
  i2cController(int Foo);
  void write(int value);
};
</code></pre>

<p>i2cController.cpp</p>

<pre><code>#include &lt;i2cController.h&gt;

i2cController::i2cController(int Foo)
{
  foo = Foo;
}

void i2cController::write(int value)
{
  foo++;
}
</code></pre>

<p><strong>Led class (receiving object reference, error originating from)</strong><br>
Error originates from: <code>Led::Led(int pin, i2cController &amp;Controller);</code><br>
Led.h</p>

<pre><code>#pragma once
#include &lt;i2cController.h&gt;

class Led
{
private:
  i2cController controller;
  int pin;

public:
  Led(int pin, i2cController &amp;Controller);
  void turnOn();
};
</code></pre>

<p>led.cpp</p>

<pre><code>#include &lt;Led.h&gt;

Led::Led(int Pin, i2cController &amp;Controller)
{
  controller = Controller;
  pin = Pin;
}

void Led::turnOn()
{
  controller.write(pin);
}

</code></pre>

<p><strong>main</strong></p>

<pre><code>i2cController controller(5);
Led led1 = new Led(led1Pin, controller);
</code></pre>
