setVector() instead expects a reference but the assignment "vector<Classname*> vectorToSend = pointerToClass->getVector();" should not compile.
pointerToClass->setVector(pointerToAnotherClass->getVector());should compile fine if getVector() returned a reference or setVector accepted a pointer. Of course
pointerToClass->setVector(*pointerToAnotherClass->getVector());would work without further change but I'm not a fan of using pointers and references interchangeably unless there is a good semantic reason for it (which I cannot see here).
On a sidenote, saying "for some reason, this code is invalid" is not helpful. The compiler (or linker) produces an error message which should have been posted.