In the US, a VFR aircraft request VFR flight following and is given a squawk code after takeoff. 15nm before arriving at it's destination class D airport, the TRACON facility instructs the pilot to "contact the destination tower".
The pilot keeps his squawk code and change frequency to contact the destination tower. The tower instruct the pilot to enter "straight-in" for the runway in use. However, in order to enter straight-in, the pilot must briefly transit through the class C shelf of an adjacent airport and through the class D of another airport not far from the destination.
Q: Is the pilot cleared to transit through both adjacent C and D airspace since he still squawking the code provided by the local TRACON?
I understand the legal requirements to enter each airspace (AIM 3-2). If the pilot was still in contact with the TRACON facility he would be cleared to enter adjacent C and D airspace since he is squawking a discrete code AND previously established two-way communication. In this case however, the pilot is not anymore talking to the TRACON and switched to the destination tower. I cannot find an official reference that covers this particular scenario.
I came across this question/answer, Does Flight Following automatically include permission to fly through class C or D airspace?, before posting but my scenario is different since the pilot is not talking to the TRACON anymore. It's subtle but makes a big difference.