title: Friend Function of Class produces error: "no '___' member function declared"
body: <p>I have a class, and I am trying to create a friend function to operate on the data of that class.</p>
  
  <p>Here is an example of what I am trying to do:</p>
  
  <pre><code>// test.hpp
  class test
  {
  public:
      friend void friendly_function();
  private:
      int data;
  };
  
  void test::friendly_function()
  {
      data = 0;
  }
  </code></pre>
  
  <p>However, the compiler spits out an error: <code>test.hpp:23:34: error: no ‘void test::friendly_function()’ member function declared in class ‘test’</code></p>
  
  <p>I know I can declare operators in this way, like so:</p>
  
  <pre><code>class test
  {
  public:
      friend const bool operator&lt;(const test&amp; _lhs, const test&amp; _rhs);
  private:
      int data;
  };
  
  const bool test::operator&lt;(const test&amp; _lhs, const test&amp; _rhs)
  {
      return (_lhs.data &lt; _rhs.data);
  }
  </code></pre>
  
  <p>So why can't I do this with <code>friendly_function</code>? Are friend functions only allowed as operators?</p>