In this case, line 23 constructs a stringstream from mystr, then uses it as an input stream to read from it into yours.year effectively letting the stream do the conversion from the string into an int.
Note that the code uses getline at line 20 to input the title rather than cin >>.
This allows the title to contains spaces. cin >> would stop at the first whitespace.
In the case of the year, cin >> could have been used directly.
Also note that the code doesn't do any error checking.
What if a non-numeric is entered for year?
stringstream inherits from istream, so it has all the same conversion functionality as istream.