How to assign a value to a member of UMG's UMaterialInterface pointer type in C++?

You could use BindWidget to just assign it in the widget editor.

You would of course have access to it in c++ as well.
Just be sure to name your variable in the blueprint just like the BindWidget name and you’re set.