Because what you are passing doesn't match the types so we enter into conversion sequences to find the overload to use. Both versions of function can be implicitly created from a lambda object that returns int. Thus the compiler can't decide which to choose to create; though it seems intuitively obvious the rules in C++ don't allow for it.
Written off the cuff but I think this could do the trick:
The calls to f in main are ambiguous. Apparently because the
conversion sequences to std::function from the lambdas are
identical. The standard specifies that the function object given to
std::function "shall be Callable (126.96.36.199) for argument types
ArgTypes and return type R." It doesn't say that if this is not
the case, the constructor isn't part of the overload set.
Try using a function pointer as an argument instead: