So as you said, CA + CAFA = 0 under a floating exchange rate, disregarding net errors and omissions. This is because under a floating exchange rate, the price mechanism is determined by the demand and supply of the currency which at equilibrium, should equal.
This means that supply (we exchange our currency for foreign currency): M (Imports), Y outflow (returns on investment in CA) and K outflows (domestic investment overseas recording in FA) = demand (they exchange their currency for ours): X (Exports), Y inflow and K outflow.
Therefore by rearranging, CA ( X-M + Y (inflows -outflows)) = CAFA (K (inflows-outflows) hence deficit on CA is surplus on CAFA.
This is a direct result of foreign investment recorded as surplus in CAFA, which leads to returns on that investment (interest, dividends and rent etc) being paid overseas and hence recorded as a deficit in the CA. Therefore CA+CAFA= 0, and size of CAD directly corresponds to size of CAFA surplus under a floating exchange rate.