Function to return custom Data Type

Strange, is it ( library.h ) in the sketch folder?
Did you restart the IDE so the tab for it appears?

Did you use #include "library.h" or #include <library.h>, for sketch folder you want "" not <> version.

If its not one of these problems, you're gonna have to post your library.h contents and your sketch contents.
Also, try putting a forward declaration of the class/struct above the #include line.