For an analogy, if I just want a loaf of bread and all I have to trade is my car or any other valuable thing.
The problem of a barter economy is exactly that.
It presupposes that an individual who wants to have a particular good, exchanging for this other goods he has in excess with respect to their needs, finds another individual who, at the same time, has the opposite wish.
This is the problem called double coincidence of needs.
With the arrival of monetary exchange, the convention arises to accept a particular good, money, in exchange of any good one wants to offer and vice versa.
Thanks to money, the double coincidence of needs is ‘split’ , and there is no longer the necessity that pairs of individuals with reciprocal intentions meet.
In that case the trade might not occur at all if we would restrict people strictly to use barter. As BakerStreet answer points out this is classic problem with barter.
In pre-historic economies this was a bit of a less of an issue as everyone was more or less equally poor. The difference in value would of course still occur but pre-historic societies were composed of small tribes where everyone knew each other. In such setting barter trade would work in a way where a member of a tribe would not even get goods immediately in exchange for goods provided to the tribe but rather get favors from other members of the tribe back over extended period of time (in fact anthropologists consider this gift giving although economically its more of an barter with social component).
However, obviously this sort of socially enforced barter exchange can only work in small hunter-gatherer communities where everyone knows everyone. Virtually all advanced civilizations used some sort of money, to facilitate exchanges, precisely to get around problems such as the one you describe.
It can be resolved through debt.
J. Wellington Wimpy tells Popeye, "I will pay you Tuesday for a hamburger today." (Yeah, they didn't have hamburgers back then, but hey, you mentioned cars, so…) Popeye will remember that Wimpy owes him for one hamburger. Wimpy can pay off his debt when he acquires something worth a hamburger that Popeye wants, or perhaps Popeye will allow Wimpy's debt to grow until Wimpy can trade in something bigger.
Let's say though that Wimpy keeps racking up debt and Popeye gets tired of Wimpy not paying any of it. "Wimpy," says Popeye, "Ya gots ta do somethin'. I've given ya 15 hamburgers now and I gots nuthin' ta show for it."
"Very well," says Wimpy, "but I need to eat, and all I have right now is my car, and we both know my car is worth more than 15 hamburgers. It's worth more like 1000 hamburgers."
"How's about ya gives me yer car and then I owes ya 985 hamburgers?"
"It's a deal!"
So now the debt is flipped around and Popeye owes Wimpy.
What if instead Wimpy left town? Well, where would he go? Societies were small back then, and neighboring tribes were usually at least a little hostile. They probably wouldn't be too eager to welcome someone fleeing from a debt.
Over time, the town grows and Popeye's hamburger business is booming, and he's starting to have trouble keeping track of whom he owes and who owes him and how much. There are two solutions Popeye might find: he could start keeping a transaction journal, thus inventing proto-writing, or he could start issuing tokens for debt.
Let's say Popeye commissions some people to make little silver tokens for him. They can make as many tokens as they have metal for, and they can exchange them for one hamburger each. This goes on for some time until Popeye has accumulated a lot of tokens and distributed many of them to his patrons. Eventually, Popeye receives a token from someone he's sure he's never met before. "Hey, what gives?" Popeye asks. "I don't owes ya a hamburger."
"No," says the patron, "but you owe Olive Oyl one, and she traded her token to me. So if you give me a hamburger, that settles your debt to Olive Oyl, and it settles her debt to me."
"Well, blow me down!" says Popeye. "Makes sense ta me. Here's your hamburger." Soon people are trading the tokens among each other for other goods and services as well, and thus coinage was invented.
I realize I've digressed quite a bit here, but it flowed so naturally that I couldn't resist. My point is that barter systems will lead to debt systems, and debt systems will eventually lead to coinage, thus solving the problem. Of course, it might take a long time for that to happen, especially since coins are not trivial to make, and coins are a lot easier to circulate when you have a big government making them, but the principles are still the same.
There are two types of barter economies in the world: textbook barter economies, and real barter economies.
In a textbook economy, if you have a car and want a loaf of bread, you're stuck. You need to either accept a wildly unfavorable exchange or you need to put together some sort of convoluted scheme to make change for a car.
A real barter economy doesn't work that way. Real barter-economy transactions almost always take place between people who have known each other for decades, and are more akin to a running exchange of favors than a single-transaction purchase.
In a real barter economy, you might make a deal with the village baker to get fresh bread for a week in exchange for a ride at some point in the future. Since this is far from the first time you and the baker have interacted, the baker knows if you can be trusted to make good on your promise. (And you could very well end up with the baker asking you to give someone else a ride instead, to settle some other favor owed.)
Although economics textbooks sometimes claim that pre-modern economies were based on barter, my understanding is that there is actually very little evidence for this claim.
No example of a barter economy, pure and simple, has ever been described, let alone the emergence from it of money . . . All available ethnography suggests that there never has been such a thing.
Duffy and Puzzello (2014) make the same point using different language:
. . . there is no evidence for quid-pro-quo barter exchange systems as a predecessor to monetary exchange systems in the anthropological record.
As you will see in the Atlantic piece, there is good evidence of societies based on a kind of ‘gift exchange’: you give me something today on the implicit understanding that I will do something for you at a later date. While this resembles the kind of barter described in economics textbooks, and perhaps even could be called 'barter', it is different for at least two reasons:
- In pre-modern economies, favours would not need to be done at the same time. So this is (at best) a form of 'inter-temporal barter'.
- More importantly, my understanding is that people would not usually co-operate at a pre-determined rate of exchange (e.g. if you give me 1 apple, I will give you three bananas later). This also weakens the analogy with simple models of 'barter exchange'.