Are you sure you get the error when compiling that code? If so what compiler and version are you using?
The error means that there is more than one thing you could be referring to when you write string, which suggests that you are defining string somewhere. You could get rid of the error be qualifying the name std::string instead of string but that isn't really the crux of the issue.