A farmer has to cross a river with a wolf, a goat, and a cabbage. He has a boat that can carry only himself and one other item at a time. If left alone, the wolf will eat the goat, and the goat will eat the cabbage. How does the farmer get all three across the river safely?