The composition of capital inflows to emerging market economies tends to follow a predictable dynamic pattern across the business cycle. In most emerging market economies, total inflows are procyclical, with debt and portfolio equity flowing in first, followed later in the expansion by foreign direct investment (FDI). To understand the dynamic composition of these flows, we use a small open economy (SOE) framework to model the composition of capital inflows as the equilibrium outcome of emerging market firms' financing decisions. We show how costly external financing and FDI search costs generate a state-contingent cost of financing such that the cheapest source of financing depends on the phase of the business cycle. In this manner, the financial frictions are able to explain the interaction between the types of flows and deliver a time-varying composition of flows, as well as other standard features of emerging market business cycles. If, as this work suggests, flows are an equilibrium outcome of firms' financing decisions, then volatility of capital inflows is not necessarily bad for an economy. Furthermore, using capital controls to shut down one type of flow and encourage another is certain to have both short- and long-run welfare implications.