Which of the following is a compound sentence?

A. We saw pandas during our visit to the zoo.

B. It was a beautiful day, so we decided to go to the zoo.

C. Before we left, I bought a hat at the gift shop.

D. To get to the zoo, we took the train and a cab.

D. To get to the zoo, we took the train and a cab.