title: C++ compiler unable to find function (namespace related)
body: <p>I'm working in Visual Studio 2008 on a C++ programming assignment. We were supplied with files that define the following namespace hierarchy (the names are just for the sake of this post, I know "namespace XYZ-NAMESPACE" is redundant): </p>
  
  <pre><code>(MAIN-NAMESPACE){
  
        a bunch of functions/classes I need to implement...
  
        (EXCEPTIONS-NAMESPACE){
  
              a bunch of exceptions
        }
  
        (POINTER-COLLECTIONS-NAMESPACE){
  
              Set and LinkedList classes, plus iterators
        }
  }
  </code></pre>
  
  <p>The MAIN-NAMESPACE contents are split between a bunch of files, and for some reason which I don't understand the operator&lt;&lt; for both Set and LinkedList is entirely outside of the MAIN-NAMESPACE (but within Set and LinkedList's header file). 
  Here's the Set version: </p>
  
  <pre><code>template&lt;typename T&gt;
  std::ostream&amp; operator&lt;&lt;(std::ostream&amp; os, 
                           const MAIN-NAMESPACE::POINTER-COLLECTIONS-NAMESPACE::Set&lt;T&gt;&amp; set)
  </code></pre>
  
  <p>Now here's the problem: I have the following data structure: </p>
  
  <pre><code>Set A
  Set B
  Set C
  double num
  </code></pre>
  
  <p>It's defined to be in a class within MAIN-NAMESPACE. When I create an instance of the class, and try to print one of the sets, it tells me that: 
  error C2679: binary '&lt;&lt;' : no operator found which takes a right-hand operand of type 'const MAIN-NAMESPACE::POINTER-COLLECTIONS-NAMESPACE::Set' (or there is no acceptable conversion)</p>
  
  <p>However, if I just write a main() function, and create Set A, fill it up, and use the operator- it works. </p>
  
  <p>Any idea what is the problem? (note: I tried any combination of using and include I could think of). </p>