That works in trivial cases but is not useful advise for the general case. Just because something can be allocated on stack does not mean every instance you have to work with is allocated on the stack. I have frequently worked in systems where instances might have to be deleted by library function A, library function B, by the standard delete or not at all (because they are a static instance on the stack).Lol all this topic has gone way off course, if you're pointing to stack memory use a naked pointer, there isn't any reason to use a shared_ptr in this case. If you wanted to you could use a reference, but there isn't much benefit in that except some cleaner syntax, but then you can't null the reference if you needed to.
I was speaking specifically about the OP's case.