how to create a variable in .h file

Shouldn't the variable 'stored' be available for the .cpp file with the same name as the .h file? or am I misguided here?

Yes, you are misguided.
You need to #include the file - there is nothing automatic about files with similar names being included.