0

I get this error:

error C2785: 'std::ostream &operator <<(std::ostream &,const Outsider<T>::Nested &)' and '<Unknown>' have different return types

When trying to compile the following code with VS2008:

```
#include <iostream>
using namespace std;
template <class T>
class Outsider {
private:
class Nested {
private:
T myData;
public:
Nested(const T &);
friend ostream & operator << <>(ostream &, const Nested &);
};
Nested *myNested;
public:
Outsider(const T &);
~Outsider();
friend ostream & operator << <>(ostream &, const Outsider &);
};
template <class T>
Outsider<T>::Nested::Nested(const T &data) : myData(data) {}
template <class T>
ostream & operator << <>(ostream &out, const typename Outsider<T>::Nested &nested) {
return out << data << endl;
}
template <class T>
Outsider<T>::Outsider(const T &data) : myNested(new Nested(data)) {}
template <class T>
Outsider<T>::~Outsider() {
delete myNested;
}
template <class T>
ostream & operator << <>(ostream &out, const Outsider<T> &outsider) {
return out << *outsider.myNested << endl;
}
void main() {
Outsider<int> outsider(5);
cout << outsider << endl;
}
```

Operator << compiles cleanly for the Outsider class but not for the Nested class. Why is this? How can I fix it?

Thanks