Visual C++ and friend functions giving errors

I'm having a problem with a friend fucntion that overloads operator << to print my class. This is pretty simple and I've modeled my function after the Dietel book. My other functions work.

My class:

class DynamicArray{

friend ostream& operator<<(ostream&,const DynamicArray& );

public:

~DynamicArray();

DynamicArray(int size = 1, int value = 0);

DynamicArray (int array [], int size = 1);

DynamicArray (const DynamicArray &);

DynamicArray& operator=(const DynamicArray &);

int& operator [] (int index);

int GetFront (void) const;

int GetBack (void) const;

void InsertAtIndex (int value, int index); (other functions)

private:

int size;

int capacity;

int * ptr;

};

And then I wrote this to print my class. Linux doesn't give me any problems but this pukes with Visual C++.

ostream & operator<<( ostream& output, const DynamicArray& rhs)

{

//test for empty array

if(rhs.size == 0)

{

output << "DynamicArray is empty" << endl;

return output;

}

//otherwise print out the array as "output"

for(int i = 0; i < rhs.size; i++)

{

output << rhs.ptr[i] << ",";

}

output << endl;

return output;

}

Can anyone spot what the problem is?

Thanks,

Robert