it works for me since department.h is included before staff.h in main.cpp.
But I do notice that you are including Department.h in the header that defines department, and likewise for Staff.h, which isn't the reason for any errors since my code works even if this is true, the only way this code can fail is if the file with department is actually named Staff.h and likewise with the other file, since you load department.h before staff.h, which makes this code work for me (even if there are large problems with your code).
OR it may be possible that you have files that you haven't shown us which can change the order the headers are parsed (much more likely).
Also I can make an essay about what is wrong with your code, but you should probably read more tutorials/ larger than one file examples on C++ since you have a lot to learn, and C++ will punish you if you think you can get away with figuring it out the basics by trial and error (especially with the fact you are writing your code C-ish, if you want to use C data, read C tutorials).