Continuous function and compactifications

Can someone help me on this one?

Given two compact Hausdorff Space $\displaystyle X,Y$ and a continuous function $\displaystyle f:X\rightarrow Y$ which conditions are necessary and sufficient to garantuee the existence of a continuous function $\displaystyle \hat{f}:\hat{X}\rightarrow \hat{Y}$ such that $\displaystyle \hat{f}|X=f$ ($\displaystyle \hat{f}$ restricted to $\displaystyle X$) where $\displaystyle \hat{X},\hat{Y}$ are the one-point compactifications?