title: Mocking free function
body: <p>I am stuck in a problem and can't seem to find the solution.</p>
  
  <p>I am using VS2005 SP1 for compiling the code.</p>
  
  <p>I have a global function:</p>
  
  <pre><code>A* foo();
  </code></pre>
  
  <p>I have a mock class</p>
  
  <pre><code>class MockA : public A {
  public:
      MOCK_METHOD0 (bar, bool());
      ...
  };
  </code></pre>
  
  <p>In the sources, it is accessed like this: <code>foo()-&gt;bar()</code>. I cannot find a way to mock this behavior. And I cannot change the sources, so the solution in google mock cook book is out of question.</p>
  
  <p>Any help or pointers in the right direction will be highly appreciated. :)</p>