The following code does not compile, why?

1 int main ()
2 {
3 enum Day { Sun, Mon, Tue };
4
5 Day& operator++ (Day& d)
6 {
7 d = (Day) (d + 1);
8 return d;
9 }
10 }

Line 5 generates a compiler error similar to the following...

Unrecognized type name "Day"

This was compiled on a Sun box running Solaris 8 with their C++ compiler version 5.3.

Is there some fundamental problem with this code, or is this possibly a bug in the compiler?