Okay here's my situation I have even arrested for possession of marijuana. How it happened was that I went to drop friends off at this guys house who happened to to steal a phone that day and it was reported. So right after I pull up to his house(owned by his parents not himself) in his drive way and then a cop pulls behind me and he goes up to the guy who lives there and me and my friends were in the car while he was on his lawn. The cop says are you ready to goto jail to the guy, he says he is going to jail for stealing an iPhone that was tracked back to his house and witnesses said he stole it. He searched him and didn't find it on him and the cop told him to go get his dad and they talked and he couldn't arrest him for a crime he has no actual proof or whatever, well anyway he asked him were the phone was he replied I don't know. Then the cop asked if it was "in this car"(my car) then he said" i don't know". So the cop says to us"we'll know I have the right to search this car for further investigation"( I don't know if that is exact wording but just general idea I can remember) so then he talks some more and then says"hmm.. Why does it smell like marijuana coming from this car?"(which I had in my car, but I was not pulled over or committed any crime or violation, he only smelled it and from what I think is that the cop knew he couldn't search me just because the guy stole the phone and we were there, so he said he smelt it so he could search.. So now he is searching for phone and drugs.) but anyways he continued and said" I know have the right to search this car because if probable cause and to step out of the car we are going to be searched" we step out and sit on side of the car and adventually another cops shows up and they find the drugs. Which was about .2 of a gram also known as "Shake" so we get arrested. Know my main concern is that was it legal to search us sense he wasn't their for us and wasn't there for any drug related activity or didn't pull us over or had no probable cause for the phone except we are there, even the other guy said we just showed up and didn have the phone or weren't involved. But was it legal to search us since we weren't pulled over or anyother crime was committed before, if not what should I do?