The police can stop a car based on an articulable suspicion. That is something less than probable cause but more than a hunch. All the officer needs to approach the car and question the driver is a reason he can put into words. Here the officers received a call of a person asleep at the wheel of his car in a drive thru. That is supicious and something that the police would reasonably wish to investigate.
With that, the police are allowed by law to inquire of the driver, to get his identification, license and insurance information and to pull him out of the car and pat him down for their safety. All of this has been the law since Terry v. Ohio was decided in the late 1960s by the US Supreme Court.
While the police would then need probable cause and a warrant or an exception to a warrant requirement to search the car, they are entitled to seize what appears in plain view, such as the gun under the seat.
That said, the Supreme Court has also ruled that there are no hard and fast rules about what is or isn't Constitutional. Matters of whether the police have exceeded their authority in violation of a defendant's rights must be determined at a pre-trial suppression hearing that the defense can move for. There is where the defense would explore and challenge any issues relating to the stop, the search and seizure, and the lack of Miranda warnings.
The standard that a judge must apply when he evaluates the evidence that comes from this hearing is what would be reasonable for an officer to do under the same facts and circumstances. So at the hearing, the DA will put the officer on the stand and ask questions designed to make the police actions look as reasonable as possible. Then the defense lawyer cross-examines to show how the police officer unreasonably overreached his authority in violation of the defendant's right. After the close of all the evidence, the judge decides for one side or the other.
If the judge decides that the police conduct was what a reasonable officer would have done under the same circumstances, the case will proceed to trial. However, if it is found that the police violated the defendant's 4th and 5th Amendment rights, evidence illegally obtained could be suppressed, meaning it could not be used against the defendant. In a possessory case such as this one, if the gun and the paraphernalia get suppressed, there would be no case and it would have to be dismissed.