Police officers can ask to search your car. However, you have every right to say NO! One of the problems these days is that cops will make something up to give them justification to search your vehicle. If they are going to arrest you for a crime they have observed, or otherwise have probable cause to search, they do not need your permission. That they asked for your permission means that they know they do not have probable cause and are taking a shot in the dark that they can intimidate you into giving consent (a way around the 4th Amendment) and will find something in your vehicle for which they can arrest you. Politely and calmly say no, you may not search my vehicle, and try to diffuse the situation. When you say no, that may upset them, but it is your only protection.