xlC compilation error when dealing with operator overloading

Hi,

I have a piece of C++ code that can be compiled using g++, but reports an error when compiled with xlC:

xlC -DHAVE_CONFIG_H -I../SRC -I../include -DNoChange -DSPRNG_MPI -q64 -DLONG64=long -I/usr/lpp/ppe.poe/include -DLONG64=long -c -o libsprng_a-bignum.o bignum.cpp
"bignum.cpp", line 1280.8: 1540-0040 (S) The text "&" is unexpected. "ostream" may be undeclared or ambiguous.

The code segment is as below:

ostream& operator << (ostream& os, const BigNum& bn)
{
unsigned long int * ptr;
unsigned long int i = 1;

if (!bn.v)
return os;

ptr = bn.v + bn.Size() - 1;

os.setf(ios::uppercase);
os << hex << *ptr--;

while (i < bn.size) {
i++;

if \(NUMBITS == 32\)
  os &lt;&lt; setw\(8\) &lt;&lt; setfill\('0'\) &lt;&lt; hex &lt;&lt; *ptr--;
else
  os &lt;&lt; setw\(16\) &lt;&lt; setfill\('0'\) &lt;&lt; hex &lt;&lt; *ptr--;

}

os << endl;
// ptr = 0;

return os;
}

The problem has been solved

it would have been nice to tell us how you have solved it in exchange for our willingness to solve it for you if you would not have been able to do it yourself.