Implement automatic casting to value