title: How to mock method used with the class declared inside free function?
body: <p>I want to mock method set in class Man.
  How to make it with gmock? 
  This is how I try. What is wrong? </p>
  
  <pre><code>bool Man::set(uint8_t val)
  {
  //not important, let it be
   print("aaa");
  }
  
  
  bool alfa(bool a)
  {
      Man m;
      m.set(a == true ? 1 : 0);
  
      return true;
  }
  
  class MockMan : public Man {
   public:
      MOCK_METHOD(bool, set, (uint8_t val));
  };
  
  
  TEST(unit_test, Alfa_test) {
      MockMan mock;
  
      EXPECT_CALL(mock, set(1));
  
      EXPECT_EQ(alfa(true), true);
  }
  </code></pre>
  
  <p>I simplified the code a lot :)
  What is the problem? Mock is not called, instead I always get original method 'set' called and aaa printed. </p>