We set up a DSGE model to study the macroeconomic consequences of a foreign central bank digital currency (CBDC) available to residents in a small open economy. We find that a gradual and permanent increase in the domestic households' preferences toward the foreign CBDC leads to a structural reduction in economic activity, especially if the CBDC is designed to be similar to domestic deposits. Imposing capital flow management measures on outflows, relaxing macroprudential policy, or selling foreign reserves can smooth the transition. A Taylor rule that targets PPI inflation is more effective in limiting the disruptive effects than a CPI targeting or an exchange rate peg. A central bank's liquidity facility available to commercial banks is able to avoid the long-run GDP loss, at the cost of a larger short-run consumption fall. We also show that an economy with a large stock of foreign CBDC is better shielded from exogenous increases in the interest rate on foreign debt, if the CBDC remuneration remains constant.