To be an investor, you first need money to invest. That ultimately comes from running a surplus. The same holds true for countries. The ones who run a surplus can create huge portfolios of assets. Chinese sovereign funds are nearly $1 trillion.
The Economist had a chart showing the hierarchy of countries that pay themselves first. The US and Canada pays these guys first too.
Click here to see the list of largest sovereign wealth funds (accurate to March 2011).