These string streams look quite interesting. Turns out you want an istringstream though, since that acts as a 'input' from a string, i.e. allows you to read from it.
This runs:
#include <string>
#include <sstream>
//#include <ostream>
#include <iostream>
int main()
{
std::string v("42");
std::istringstream str(v);
int x;
str >> x; // will get value 42
std::cout << x << std::endl;
std::cin.sync();
std::cin.get();
}